// app.js
App({
  onLaunch() {
     wx.cloud.init({
       env: 'dev-2gpnm1yu1e99435e'
     })
  },

  globalData:{
    userInfo: {},
    zhuohao:"",
    openid:null
  },


  // 保存userinfo
  _saveUserInfo: function (user) {
    this.globalData.userInfo = user;
    wx.setStorageSync('user', user)
  },
  // _checkOpenid() {
  //   let app = this
  //   let openid = this.globalData.openid;
  //   if (!openid) {
  //     app.getOpenid();
  //     wx.showLoading({
  //       title: 'openid不能为空，请重新登录',
  //     })
  //     return null;
  //   } else {
  //     return openid;
  //   }
  // }


  getCurrentTime() {
    var d = new Date();
    var month = d.getMonth() + 1;
    var date = d.getDate();
    var day = d.getDay();
    var hours = d.getHours();
    var minutes = d.getMinutes();
    var seconds = d.getSeconds();
    var ms = d.getMilliseconds();

    var curDateTime = d.getFullYear() + '-';
    if (month > 9)
      curDateTime += month + '-';
    else
      curDateTime += '0'+month + '-';

    if (date > 9)
      curDateTime = curDateTime + date + " ";
    else
      curDateTime = curDateTime +'0'+ date + " ";
    if (hours > 9)
      curDateTime = curDateTime + hours + ":";
    else
      curDateTime = curDateTime +'0'+ hours + ":";
    if (minutes > 9)
      curDateTime = curDateTime + minutes ;
    else
      curDateTime = curDateTime +'0'+ minutes ;
    return curDateTime;
  },
})
